package com.binhthuan.catechist.client.grid;

import com.binhthuan.catechist.client.ECApplication;
import com.binhthuan.catechist.client.data.ShiftDS;
import com.binhthuan.catechist.shared.constant.Parameter;
import com.smartgwt.client.widgets.grid.ListGridField;

public class ShiftGrid extends AbstractGrid {

    public ShiftGrid(ShiftDS dataSource) {
        super(dataSource);

        setWrapCells(true);

        ListGridField idField = new ListGridField(Parameter.ID);
        idField.setHidden(true);
        idField.setCanHide(false);

        ListGridField nameField = new ListGridField(Parameter.NAME);
        nameField.setTitle(ECApplication.getConstants().shiftName());

        ListGridField dayOfWeekField = new ListGridField(Parameter.DAY_OF_WEEK);
        dayOfWeekField.setTitle(ECApplication.getConstants().dayOfWeek());

        ListGridField startTimeField = new ListGridField(Parameter.START_TIME);
        startTimeField.setTitle(ECApplication.getConstants().startTime());
        startTimeField.setWidth(150);
        
        ListGridField endTimeField = new ListGridField(Parameter.END_TIME);
        endTimeField.setTitle(ECApplication.getConstants().endTime());
        endTimeField.setWidth(150);

        setSortField(Parameter.NAME);
        setFields(idField, nameField, dayOfWeekField, startTimeField, endTimeField);
    }
}
